Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@thi.ng/hex
Advanced tools
Hex string formatters for 4/8/16/24/32/48/64bit words, hexdump formatting of binary data
[!NOTE] This is one of 199 standalone projects, maintained as part of the @thi.ng/umbrella monorepo and anti-framework.
🚀 Please help me to work full-time on these projects by sponsoring me on GitHub. Thank you! ❤️
Hex string formatters for 4/8/16/24/32/48/64bit words, hexdump formatting of binary data.
STABLE - used in production
Search or submit any issues for this package
yarn add @thi.ng/hex
ESM import:
import * as hex from "@thi.ng/hex";
Browser ESM import:
<script type="module" src="https://esm.run/@thi.ng/hex"></script>
For Node.js REPL:
const hex = await import("@thi.ng/hex");
Package sizes (brotli'd, pre-treeshake): ESM: 631 bytes
None
import * as h from "@thi.ng/hex";
const cssColor = (x: number) => "#" + h.U24(x);
cssColor(10597059)
// "#a1b2c3"
h.U48(223928981472033);
// "cba987654321"
h.U48HL(0xcba9, 0x87654321)
// "cba987654321"
h.U64(0xaa * 0x010101010101)
// "0000aaaaaaaaaaaa"
h.U64HL(0x11223344, 0x89abcdef);
// "1122334489abcdef"
// format directly from byte arrays
const BUF = [1, 2, 3, 4, 0x10, 0x20, 0x30, 0x40];
// big-endian
h.U32BE(BUF, 0)
// "01020304"
h.U32BE(BUF, 4)
// "10203040"
// little-endian
h.U32LE(BUF, 0)
// "04030201"
h.U32LE(BUF, 4)
// "40302010"
If this project contributes to an academic publication, please cite it as:
@misc{thing-hex,
title = "@thi.ng/hex",
author = "Karsten Schmidt",
note = "https://thi.ng/hex",
year = 2020
}
© 2020 - 2024 Karsten Schmidt // Apache License 2.0
FAQs
Hex string formatters for 4/8/16/24/32/48/64bit words, hexdump formatting of binary data
The npm package @thi.ng/hex receives a total of 93,188 weekly downloads. As such, @thi.ng/hex popularity was classified as popular.
We found that @thi.ng/hex demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.